{extend name="index_base" /}
      {block name="seo"}
        <title>{$t.title}|{$site_config['site_title']}|{$site_config['seo_title']}</title>
  
  
  <meta name="keywords" content="{$site_config['seo_keyword']}">
  <meta name="description" content="{$site_config['seo_description']}">
      {/block}
   {block name="css"}    
<link rel="stylesheet" href="__PUBLIC__/wangEditor/css/wangEditor.min.css">

<style type="text/css">
.wangEditor-menu-container .menu-item a {padding: 12px 0;}
.wangEditor-menu-container .menu-item {height: 37px;width: 37px;}
.wangEditor-menu-container .menu-group {padding: 0;}
.wangEditor-container {border: 1px solid #e6e6e6;}
.pagination {margin: 0 0 20px 0;}
i{font-style: italic;}
</style>
        {/block}
{block name="body"}
<div class="main layui-clear">
  <div class="wrap">
    <div class="content detail">
	  <div class="fly-panel detail-box">
        <h1>{$t.title}</h1>
        <div class="fly-tip fly-detail-hint">
         {if condition="$t['uid'] eq session('userid')"} <span><a style="color:#fff;" href="{:url('forum/edit',array('id'=>$t['id']))}" target="_blank">编辑</a></span>{/if}
		  <span><a style="color:#fff;" class="jie-user" href="{:url('index/view',array('id'=>$t.cid))}">{$t.name}</a></span>
		  {if condition="$t['settop'] eq 1"}<span style="margin-right: 4px;" class="fly-tip-stick">置顶</span>{/if}
		  {if condition="$t['choice'] eq 1"}<span class="fly-tip-jing">精帖</span>{/if}
		  
          <div class="fly-list-hint"> 
            <i class="iconfont" title="回答">&#xe60c;</i> {$t.reply}
            <i class="iconfont" title="人气">&#xe60b;</i> {$t.view}
          </div>
        </div>
		<div class="detail-about">
		<a class="jie-user" href="{:url('user/home',array('id'=>$t.userid))}">
            <img src="{$t.userhead|getheadurl}" alt="{$t.username}">
            <cite id="zuozhename" data-id="{$t.userid}">
             {$t.username}
              <em>{$t.time|friendlyDate}</em>
            </cite>
          </a>
          <div class="detail-hits">
            <span class="margin-left:10px;" style="color:#FF5722">{$t.grades|getgradenamebyid}</span>
			<span class="" style="color:#009688">{$site_config['jifen_name']}：{$t.point}</span>
          </div>
        </div>
        <div class="detail-body photos" style="margin-bottom: 20px;">
          <div class="wangEditor-container cl" style="border: 0px solid #e6e6e6;">
            {:hook('threadviewfee',array('id'=>$t['id'],'uid'=>session('userid'),'zuid'=>$t['uid']))}	
		  <div class="wangEditor-txt" style="padding: 0;margin-top: 0;">
		  
		  
		  {$content|htmlspecialchars_decode}
		   </div>
		  
           </div>
           {:hook('threadattach')}	
           <div class="fly-tip fly-detail-hint">
		  {if condition="$t['keywords'] neq ''"}
		 {volist name="keywordarr" id="vo"}
		  <a href="{:url('index/search')}?ks={:urlencode($vo)}" blank="_blank">
		 <span class="fly-tip-jing" style="background:#c2c2c2;border-radius:2px;padding:3px 6px;margin-right:10px;">
		 
		
		 {$vo}
		
		 </span> </a>
         {/volist}
          {/if}
         
        </div>
        </div>
      </div>
      <div class="fly-panel detail-box">
        <a name="comment"></a>
        <ul class="jieda photos" id="jieda">
		  {volist name="tptc" id="vo"}
		  <li id="tpt{$vo.id}" class="jieda-daan">
            <a name="item-121212121212"></a>
            <div class="detail-about detail-about-reply">
              <a class="jie-user" href="{:url('user/home',array('id'=>$vo.userid))}">
                <img src="__ROOT__{$vo.userhead}" alt="{$vo.username}">
                <cite>
                  <i class="username">{$vo.username}</i>
				 <!-- <em>(楼主)</em>
                  <em style="color:#5FB878">(管理员)</em>
                  <em style="color:#FF9E3F">（活雷锋）</em>
                  <em style="color:#999">（该号已被封）</em> -->
                </cite>
              </a>

              <div class="detail-hits">
                <span>{$vo.time|friendlyDate}</span>
              </div>
              <i class="iconfont icon-caina" style="display:none" title="最佳答案"></i>
            </div>
            <div class="detail-body jieda-body">
              <p>{$vo.content|htmlspecialchars_decode}</p>
              {if condition="$vo['tid'] gt 0"}
              <div class="home-dacontent">
          {$vo.tid|getcommentbyid}
          </div>
              
              {/if}
              
              
            </div>
            <div class="jieda-reply">
              <span class="jieda-zan " data-id="{$vo.id}" type="zan">
              <i class="iconfont icon-zan"></i><em>{$vo.praise}</em>
              </span>
              <span type="reply"  data-id="{$vo.id}" >
              <i class="iconfont icon-svgmoban53"></i>
              回复</span>
              
                
            {if condition="$vo['uid'] eq session('userid')"}
               <div class="jieda-admin">
                <span type="edit"><a style="color:#999" href="{:url('comment/edit',array('id'=>$vo['id']))}" target="_blank">编辑</a></span>
               
              </div> 
            {/if}
            </div>
          </li>
          {/volist}
        </ul>
		<div class="pages">{$tptc->render()}</div>
		<div id="pinglun" class="layui-form layui-form-pane">
          <form>
            <div class="layui-form-item layui-form-text">
              <div class="layui-input-block" >
              <span id="huifu"></span>
                 <textarea id="textarea" name="content" style="height:150px;width: 100%;" required lay-verify="required"></textarea>
              <input type="hidden" name="tid" value="0" id="tid" />
              </div>
            </div>
            <div class="layui-form-item">
              <button class="layui-btn" lay-submit="" lay-filter="comment_add">提交回答</button>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
{include file="index/right"}
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__PUBLIC__/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/wangEditor/js/wangEditor.min.js"></script>

<script type="text/javascript">
var editor = new wangEditor('textarea');
$.get('{:url("index/getemotion")}',function (data){

	editor.config.uploadImgUrl = '{:url("index/forum/doUploadPic")}';
	editor.config.uploadImgFileName = 'FileName';
	var emotiondata;
	emotiondata=data;
	emotiondata = JSON.parse(emotiondata);
	editor.config.emotions =emotiondata;
	editor.config.menus = [
	                       'bold',
	                       'underline',
	                       'italic',
	                       'strikethrough',
	                       'forecolor',
	                       'link',
	                       'unlink',
	                       'emotion',
	                       'img',
	                     
	                       'insertcode',
	               		'fullscreen',
	                   ];
	editor.config.pasteText = false;
    editor.create();
});
  
    
    
</script>
<script>

layui.use('form', function(){
  var form = layui.form()
  ,jq = layui.jquery;
  jq('span[type=zan]').click(function(){
var idnum=jq(this).data('id');
var obj=jq(this);
jq.post('{:url("index/zan")}',{'id':idnum},function(data){
    if(data.code == 200){
    	 jq(obj).addClass('zanok');
   	  var intnum=parseInt(jq(obj).find('em').html());
   
   	  jq(obj).find('em').html(intnum+1);
      layer.msg(data.msg, {icon: 1, time: 1000}, function(){
    	 
      });
    }else{
     
      layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
    }
  });
	
	  




	  });
  jq('span[type=reply]').click(function(){
	  var idnum=jq(this).data('id');
	  
	 var htmlname='@'+ jq('li#tpt'+idnum).find('.username').html();
	
	   jq('#tid').val(idnum);
	   editor.$txt.focus();
	   jq('#huifu').html('<i style="color:#F7B824">'+htmlname+'</i>');
	  
	  
 });
  jq('.del_btn').click(function(){
    var name = jq(this).attr('nickname');
    var id = jq(this).attr('member-id');
    layer.confirm('确定删除【'+name+'】?', function(index){
      loading = layer.load(2, {
        shade: [0.2,'#000']
      });
      jq.post('{:url("index/comment/dels")}',{'id':id},function(data){
        if(data.code == 200){
          layer.close(loading);
          layer.msg(data.msg, {icon: 1, time: 1000}, function(){
            location.reload();
          });
        }else{
          layer.close(loading);
          layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
        }
      });
    });
  });

  form.on('submit(comment_add)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var param = data.field;
    jq.post('{:url("comment/add",array("id"=>$t.id))}',param,function(data){
      if(data.code == 200){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
          location.reload();
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
    return false;
  });

})
</script>
{/block}